package com.example.qingyiapp.ui.activity.fragment.fragment_FindUI.childfragment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.example.qingyiapp.R;
import com.example.qingyiapp.service.entify.FindChoicenessOneBean;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Creadted by Met·Wang on 2019/9/19 16:57
 * Describe: NullPointerException Write
 */
public class Choiceness_childfragment extends Fragment {


    Unbinder unbinder;
    @BindView(R.id.choiceness_vp_image)
    ImageView choicenessVpImage;
    @BindView(R.id.choiceness_vp_text_content)
    TextView choicenessVpTextContent;
    @BindView(R.id.choiceness_vp_userIcon)
    ImageView choicenessVpUserIcon;
    @BindView(R.id.choiceness_vp_text_userName)
    TextView choicenessVpTextUserName;
    @BindView(R.id.choiceness_vp_text_dianzan)
    TextView choicenessVpTextDianzan;
    @BindView(R.id.choiceness_vp_text_dianzan_img)
    ImageView choicenessVpTextDianzanImg;
    @BindView(R.id.choiceness_vp_text_pinglun)
    TextView choicenessVpTextPinglun;


    FindChoicenessOneBean.DataBean.PostsBean bean;


    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.choiceness_itemfragment, container, false);
        unbinder = ButterKnife.bind(this, view);

        Bundle bundle=getArguments();
        bean= (FindChoicenessOneBean.DataBean.PostsBean) bundle.getSerializable("bean");
        Glide.with(getContext()).load(bean.getPoststd()).into(choicenessVpImage);
        choicenessVpTextContent.setText(bean.getTitle()+"");
        Glide.with(getContext()).load(bean.getUsercover()).apply(RequestOptions.circleCropTransform()).into(choicenessVpUserIcon);
        choicenessVpTextUserName.setText(bean.getUser_name()+"");
        choicenessVpTextDianzan.setText(bean.getPraise_cnt()+"");
        choicenessVpTextPinglun.setText(bean.getComment_cnt()+"");


        return view;

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
